package com.xbongbong.pro.statistic.result.pojo.dto;

import com.xbongbong.pro.statistic.result.pojo.ElasticAggsPojo;
import com.xbongbong.pro.statistic.through.pojo.dto.ThroughDTO;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 统计结果单个线的数据参数信息
 * @author zcp
 * @version v1.0
 * @date 2019/4/22 20:46
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class StatisticResultInfoDTO implements Serializable {
    private static final long serialVersionUID = 8994976664941294983L;

    /**
     * 穿透所需要的参数
     * 注：当该值为null时，代表不需要穿透，即不需要穿透时该值一定要传null
     */
    private ThroughDTO throughDTO;
    /**
     * 是否画入表格内 0否1是
     */
    private Integer tableFlag;
    /**
     * 分别采用两个不同单位的y轴，默认为yAxisIndex: 0，当为1时，代表另外一个y坐标轴
     */
    private Integer yAxisIndex;
    /**
     * 是否隐藏，默认0不隐藏  1隐藏，0不隐藏
     * 如合同金额分析，环比增长和同比增长默认是灰掉的
     */
    private Integer hide;
    /**
     * 报表类型，用枚举维护@see ChartTypeEnum
     * 如果该值为空则默认用图表本身的chartType，如果不为空，则用该值渲染图类型。比如合同金额分析，图本身是柱形图，但是环比同比是折线
     */
    private Integer chartType;
    /**
     * echarts的legend
     */
    private String legend;
    /**
     * 每个legend值对应的单位
     */
    private String unit;
    /**
     * 结果，要通过legend和该值处理出data（格式为：[{"name":"","value":[]}]）
     */
    private ElasticAggsPojo elasticAggsPojo;

    /**
     * 默认一条线的实例化：y轴左侧，且不隐藏
     * @param throughDTO
     * @param tableFlag
     * @param legend
     * @param unit
     * @param elasticAggsPojo
     * @author zcp
     * @date 2019/4/23 17:29
     * @since v1.0
     * @version v1.0
     */
    public StatisticResultInfoDTO(ThroughDTO throughDTO, Integer tableFlag, String legend, String unit, ElasticAggsPojo elasticAggsPojo) {
        this.throughDTO = throughDTO;
        this.tableFlag = tableFlag;
        this.yAxisIndex = 0;
        this.hide = 0;
        this.legend = legend;
        this.unit = unit;
        this.elasticAggsPojo = elasticAggsPojo;
    }

    public StatisticResultInfoDTO(ThroughDTO throughDTO, Integer tableFlag, Integer yAxisIndex, Integer hide, String legend, String unit, ElasticAggsPojo elasticAggsPojo) {
        this.throughDTO = throughDTO;
        this.tableFlag = tableFlag;
        this.yAxisIndex = yAxisIndex;
        this.hide = hide;
        this.legend = legend;
        this.unit = unit;
        this.elasticAggsPojo = elasticAggsPojo;
    }
}
